local befriendAttackingSkill = fk.CreateSkill{
  name = "iberia__befriend_attacking_skill",
}

Fk:loadTranslationTable{ [befriendAttackingSkill.name] = "远交近攻" }

local I = require "packages/iberia/utility"

befriendAttackingSkill:addEffect("cardskill", {
  prompt = "#iberia__befriend_attacking_skill",
  target_num = 1,
  mod_target_filter = function(self, player, to_select, selected)
    return not I.isMate(player, to_select) and to_select.kingdom ~= "unknown"
  end,
  target_filter = Util.CardTargetFilter,
  can_use = function(self, player, card)
    return not player:prohibitUse(card)
  end,
  on_effect = function(self, room, effect)
    local from_draw = 2
    local to_draw = 2
    if I.isCounsellor(effect.from) then
      from_draw = from_draw + 1
      to_draw = to_draw - 1
    end
    if effect.from:isAlive() then
      effect.from:drawCards(from_draw, "iberia__befriend_attacking")
    end
    if effect.to:isAlive() then
      effect.to:drawCards(to_draw, "iberia__befriend_attacking")
    end
  end
})

return befriendAttackingSkill
